package com.yykj.base.server.converter;

import com.yykj.base.client.dto.BaseOfficerDTO;
import com.yykj.base.server.model.entity.BaseOfficer;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

public class BaseOfficerDTOConverter {
    public static BaseOfficerDTO convert(BaseOfficer baseOfficer){
        BaseOfficerDTO result = new BaseOfficerDTO();
        BeanUtils.copyProperties(baseOfficer,result);
        return result;
    }

    public static List<BaseOfficerDTO> convert(List<BaseOfficer> list){
        return list.stream().map(BaseOfficerDTOConverter::convert)
                .collect(Collectors.toList());
    }

}
